package com.idea.zd.sys.train.thread;

public class DaemonThreadTest extends Thread {

    public DaemonThreadTest(){
        super.setName("后台线程");
    }

    public void run(){
        for(int i = 0; i < 1000; i ++){
            System.out.println(getName()+" :"+i);
        }
    }

    public static void main(String [] args){
        DaemonThreadTest daemonThreadTest = new DaemonThreadTest();

        //设置成后台线程
        daemonThreadTest.setDaemon(true);

        daemonThreadTest.start();

        for(int i = 0; i < 500; i ++){
            System.out.println(Thread.currentThread().getName()+" :"+i);
        }
    }
}
